<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="avicit.platform6.core.locale.PlatformLocalesJSTL"%>
<%@page import="java.util.Locale"%>
<%@page import="avicit.platform6.api.session.SessionHelper"%>
<%@ page import="avicit.platform6.commons.utils.ViewUtil"%>
<%@ page import="avicit.platform6.commons.utils.ComUtil"%>
<%@ taglib prefix="sec" uri="/WEB-INF/tags/shiro.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<base href="<%=ViewUtil.getRequestPath(request)%>">
<%@page
	import="avicit.platform6.api.sysshirolog.impl.AfterLoginSessionProcess"%>
<%
	Object lang = session
			.getAttribute(AfterLoginSessionProcess.SESSION_CURRENT_LANGUAGE_CODE);
	String languageCode = "zh_CN";
	if (lang != null) {
		languageCode = lang.toString();
	}
	Locale locale = SessionHelper.getLocaleByUser(request);
%>

<jsp:include
	page="/avicit/platform6/component/common/EasyUIJsInclude.jsp"></jsp:include>
<jsp:include page="/avicit/im/common/ImUIJSCSSInclude.jsp"></jsp:include>
<jsp:include
	page="/avicit/platform6/modules/system/commonpopup/commonSelectionHead.jsp"></jsp:include>
<script type="text/javascript"
	src="avicit/im/lantop/basic/archivetemplatemanager/ArchivetemplatemanagerManager.js"></script>
<script type="text/javascript"
	src="avicit/im/lantop/basic/archivetemplatemanager/locale/language_<%=languageCode%>.js"></script>
<link href="static/css/custom/lantop/css/custom.css" type="text/css"
	rel="stylesheet">
<title>归档模板管理</title>
<script type="text/javascript">
sysId = "<%=request.getParameter("sysId")%>";
</script>
<style>
.datagrid-editable-input{
	width:170px !important;
	border-radius:3px;
}
.asyui-validatebox{
	width:206px !important;
}
#planName{
	width:220px;
	background: white;
	border: 1px solid #dedede;
	border-radius: 3px;
	height: 23px !important;
	line-height: 23px;
	padding-left: 10px;
	box-sizing: border-box;
}
</style>
</head>
<body class="easyui-layout" fit="true" onload='init()'>

	<div region="center" border="false">
		<div id="toolBar" style="padding: 10px 20px;">

			<%-- 添加 --%>
			<a id="addFormButton" class="easyui-linkbutton selbtn"
				href="javascript:void(0)" onclick="opean()"> <img
				src="avicit/im/lantop/documents/Filecollection/img/icon_tool08_blue.png"><span
				class="selbtc">新建</span></a>
			<%-- 编辑 --%>
			<a id="editFormButton" class="easyui-linkbutton selbtn"
				onclick="opeanProject()" href="javascript:void(0);"> <img
				src="avicit/im/lantop/common/search/image/icon_tool30_blue.png"><span
				class="selbtc"><%=PlatformLocalesJSTL
					.getBundleValue(
							"lantop.basicdatamanager.archivetemplatemanager.table.button.edit",
							"i18n.lantop", locale)%></span></a>
			<%-- 删除 --%>
			<a id="deleteLAFKI" class="easyui-linkbutton selbtn"
				onclick="deletePlan()" href="javascript:void(0);"> <img
				src="avicit/im/lantop/common/search/image/icon_tool835_blue.png"><span
				class="selbtc"><%=PlatformLocalesJSTL
					.getBundleValue(
							"lantop.basicdatamanager.archivetemplatemanager.table.button.delete",
							"i18n.lantop", locale)%></span></a>
		</div>
		<table id="dataTable" class="easyui-datagrid"
			data-options="rownumbers: false,
					animate: false,
					collapsible: false,
					fitColumns: true,
					autoRowHeight: false,
					singleSelect: false,
					pagination:true,
					pageSize:20,
					pageList:[20,30,50],
					toolbar:'#toolBar',
		    		striped:true,
					fit:true,
					method: 'post'">
			<thead>
				<tr>
					<sec:accesscontrollist hasPermission="3"
						domainObject="ArchivetemplatemanagerManager_dataTable_selects">
						<th
							data-options="field:'ID', halign:'center', align:'center',checkbox: true"
							width="220"></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="ArchivetemplatemanagerManager__phase">
						<%-- 序号 --%>
						<th
							data-options="field:'numCount', align:'center', halign:'center',title:'序号'"
							width="10"></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="ArchivetemplatemanagerManager_dataTable_fileName">
						<%-- 计划名称 --%>
						<th
							data-options="field:'ARCHIVE_FILE_KIND_NAME',align:'center', halign:'center', formatter: formatTooltip,title:'计划名称'"
							width="220"></th>
					</sec:accesscontrollist>
				</tr>
			</thead>

		</table>
	</div>
	<!-- 添加计划弹出框 -->
	<div id="dd" class="easyui-dialog" title="添加计划"
		style="width: 400px; height: 200px;"
		data-options="resizable:true,modal:true">
		<div style="text-align: center; padding: 48px 0;">
			<span style="color: red;">*</span>计划名称 <input id="planName"
				class="easyui-validatebox" data-options="required:true" /> <input
				id="commitType" value="plan" type="hidden" />
		</div>
		<div style="text-align: center;">
			<a id="addFormButton" class="easyui-linkbutton selbtnc" style="margin-right:20px;"
				iconCls="icon-im-save" href="javascript:void(0)"
				onclick="savePlan()">保存</a> <a id="addFormButton"
				class="easyui-linkbutton selbtnc" iconCls="icon-im-back"
				href="javascript:void(0)" onclick="init()">返回</a>
		</div>
	</div>
	<!-- 添加项目弹出框 -->
	<div id="QQ" class="easyui-dialog" title="添加项目"
		style="width: 600px; height: 400px;"
		data-options="resizable:true,modal:true">
		<div id="header">
			<div style="padding: 10px 5px;">
				<a id="addFormButton" class="easyui-linkbutton selbtnc"
					iconCls="icon-im-add" href="javascript:void(0)"
					onclick="saveProject()">新增项目</a> <a id="addFormButton"
					class="easyui-linkbutton  selbtnc" iconCls="icon-im-edit"
					href="javascript:void(0)" onclick="editProject()">编辑项目</a> <a
					id="addFormButton" class="easyui-linkbutton  selbtnc"
					iconCls="icon-im-remove" href="javascript:void(0)"
					onclick="deleteProject()">删除项目</a> <a id="addFormButton"
					class="easyui-linkbutton  selbtnc" iconCls="icon-im-save"
					href="javascript:void(0)" onclick="updateProjct()">保存</a> <a
					id="addFormButton" class="easyui-linkbutton  selbtnc"
					iconCls="icon-im-back" href="javascript:void(0)" onclick="init()">返回</a>
			</div>
			<div style="padding: 0 0 10px 5px;">
				<span style="color: red;">*</span>计划名称 <input id="planNameto"
					class="easyui-validatebox" /> <input
					id="commitTypeto" value="project" type="hidden" /> <input
					id="planId" type="hidden" />
			</div>
		</div>
		<table id="ProjectTable" class="easyui-datagrid"
			data-options="
					rownumbers: false,
					animate: false,
					collapsible: false,
					fitColumns: true,
					autoRowHeight: false,
					singleSelect: false,
		    		striped:true,
					fit:true,
					scrollbarSize:0,
					toolbar:'#header',
					method: 'post',
					editor:'text'">
			<thead>
				<tr>
					<sec:accesscontrollist hasPermission="3"
						domainObject="ArchivetemplatemanagerManager_dataTable_selects">
						<th id="id"
							data-options="field:'ID', halign:'center', checkbox: true"
							width="220"></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="ArchivetemplatemanagerManager_dataTable_phase">
						<%-- 序号 --%>
						<th
							data-options="field:'numCount', align:'center',halign:'center',title:'序号'"
							width="220"></th>
					</sec:accesscontrollist>
					<sec:accesscontrollist hasPermission="3"
						domainObject="ArchivetemplatemanagerManager_dataTable_fileName">
						<%-- 项目名称 --%>
						<th editor="{type:'text',options:{precision:1}}"
							data-options="field:'ARCHIVE_FILE_KIND_NAME',align:'center', halign:'center',title:'项目名称'"
							width="220" id="projectNames"></th>
					</sec:accesscontrollist>
				</tr>
			</thead>
		</table>
	</div>
</body>
<!--添加细的滚动条（垂直方向的）（给滚动的盒子节点添加perfectScrollbar()方法；  -->
<script type="text/javascript" src="static/js/platform/index/js/divscroll.js" ></script>
<script type="text/javascript">
	function init() {
		$("#dd").dialog('close');
		$("#QQ").dialog('close');

		// 获取后台计划列表信息
		$('#dataTable').datagrid({
			scrollbarSize:0,
			onLoadSuccess:function(){
				$(".datagrid-view2").find(".datagrid-body").perfectScrollbar();
			},
			url : 'platform/archivetemplatemanageController/selectPlan.json',
			queryParams : {
				commitType : $("#commitType").val(),
			},
			// 前端假分页
			loadFilter : partPurchasePagerFilter
		});
		$("#QQ").dialog('refresh');
	}

	//通用分页
	function partPurchasePagerFilter(data) {
		if (typeof data.length == 'number' && typeof data.splice == 'function') {
			data = {
				total : data.length,
				rows : data
			}
		}
		var dg = $(this);
		var opts = dg.datagrid('options');
		var pager = dg.datagrid('getPager');
		pager.pagination({
			onSelectPage : function(pageNum, pageSize) {
				opts.pageNumber = pageNum;
				opts.pageSize = pageSize;
				pager.pagination('refresh', {
					pageNumber : pageNum,
					pageSize : pageSize
				});
				dg.datagrid('loadData', data);
			}
		});
		if (!data.originalRows) {
			data.originalRows = (data.rows);
		}
		var start = (opts.pageNumber - 1) * parseInt(opts.pageSize);
		var end = start + parseInt(opts.pageSize);
		data.rows = (data.originalRows.slice(start, end));
		return data;
	}

	function selectProject() {
		$('#ProjectTable')
				.datagrid(
						{
							url : 'platform/archivetemplatemanageController/selectProject.json',
							queryParams : {
								planName : $("#planId").val(),
							},
							scrollbarSize:0,
							onLoadSuccess:function(){
								$(".datagrid-view2").find(".datagrid-body").perfectScrollbar();
							}
						});
	}
</script>
</html>